﻿using System;
using System.Data;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using Tuan.BLL;
using System.Data.SqlClient;

public partial class Pages_Index : System.Web.UI.Page
{
    public string Question1 = null;
    public string Answer1 = null;
    public string Question2 = null;
    public string Question3 = null;
    public string Question_total = null;
    DataSet ds;
    int DataNum;
    protected void Page_Load(object sender, EventArgs e)
    {
        if (!IsPostBack)
        {
            if (Request["reuid"] != null)
                Pan.Cookie.WriteCookie("reuid", Request["reuid"].ToString(), 120);
            if (Request["c"] != null)
            {
                Pan.Sys_Config.InitCity(Request["c"].ToString());
            }
        }
        
    }
    protected void LoadComment(int pid)
    {
        Tuan.BLL.Review test = new Review();
        ds = test.GetQuestAns(pid);
        DataNum = ds.Tables[0].Rows.Count;
        Question_total = DataNum.ToString().Trim();
        if (DataNum >= 1)
        {
            Question1 = ds.Tables[0].Rows[0]["Body"].ToString().Trim();
            Answer1 = ds.Tables[0].Rows[0]["Reply"].ToString().Trim();
        }
        if (DataNum >= 2)
        {
            Question2 = ds.Tables[0].Rows[1]["Body"].ToString().Trim();
        }
        if (DataNum >= 3)
        {
            Question3 = ds.Tables[0].Rows[2]["Body"].ToString().Trim();
        }
    }

   
    protected void odsProductInfo_Selected(object sender, ObjectDataSourceStatusEventArgs e)
    {
        Tuan.Model.Products obj = (Tuan.Model.Products)e.ReturnValue;
        if (obj == null)
        {
            Response.Redirect("/pages/default.aspx");
        }

        if (string.IsNullOrEmpty(obj.ProductName))
        {
            Response.Redirect("/pages/default.aspx");
        }
        this.Title = "5151团 团购网-限时消费团购-每天团购-每日团购-一天一团";
        LoadComment(obj.ProductID);
      
    }
}
